<template>
  <table v-show="list.length > 0" class="table table-bordered table-hover">
    <caption>首页广告列表</caption>
    <thead>
      <tr>
        <th class="col-xs-1">任务名</th>
        <th class="col-xs-1">类型</th>
        <th>索引</th>
        <th class="col-xs-1">跳转文案</th>
        <th class="col-xs-1">可见人群</th>
        <th class="col-xs-1">渠道地址</th>
        <th>开始日期</th>
        <th>结束日期</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="ad in list">
        <td>{{ad.title}}</td>
        <td>{{ad.type | adTypeCase}}</td>
        <td>{{ad.location}}</td>
        <td>{{ad.buttonDesc}}</td>
        <td>{{+ad.showToNewUser === 0 ? '所有人' : '新用户'}}</td>
        <td>{{ad.channel}}</td>
        <td class="col-nowrap">{{ad.startTime}}</td>
        <td class="col-nowrap">{{ad.endTime}}</td>
        <td class="text-right col-nowrap">
          <vue-index-ad-update :ad.sync="ad"></vue-index-ad-update>
          <button class="btn btn-danger btn-sm" @click="deleteIndexAd(ad.id)">删除</button>
        </td>
      </tr>
    </tbody>
  </table>
  <vue-pages :pages.sync="pages" :get-list="getIndexList"></vue-pages>
</template>
<style src="./index-ad-list.css" scoped></style>
<script src="./index-ad-list.js"></script>
